package com.nulstudio.cloud.warehouse.mapper;

import com.nulstudio.cloud.common.entity.NulWarehouse;
import com.nulstudio.cloud.common.domain.vo.WarehouseVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface WarehouseMapper {
    @NonNull
    List<NulWarehouse> fetchAll(@Param("name") @NonNull String name);

    @NonNull
    List<WarehouseVo> fetchWarehouseList(@Param("name") @NonNull String name);

    @Nullable
    WarehouseVo findWarehouseById(@Param("id") int id);

    int insert(@Param("warehouse") @NonNull NulWarehouse warehouse);

    int update(@Param("warehouse") @NonNull NulWarehouse warehouse);

    int delete(@Param("id") int id);

    boolean checkExistenceById(@Param("id") int id);

    @Nullable
    Integer fetchTypeIdByName(@Param("name") @NonNull String name);

    @NonNull
    List<String> fetchTypeList();
}
